<?php $this->load->view('header/standard'); ?>
<div id="main">
    <div class="container">
        <div class="span-17 colborder" id="content">
            <?php if (isset($messages)) echo $messages; ?>

            <div id="submenu-container" class="span-17 last">
                <?php $this->load->view('menu/profile'); ?>
            </div>

            <?php echo form_open('profile/club/delete/'.$person->id); ?>
            
	            <?php if (count($pilot->Clubs) == 0): ?>
                    <div class="span-15 last">
                        <p class="last"><?=lang('home.No_clubs_assigned')?></p>
                       <span class="span-3 last"><?php echo anchor('profile/club/add/'.$person->id, lang('profile.club.Add'))?></span>
                    </div>
	            <?php else: ?>
		            <?php foreach ($pilot->Clubs as $c): ?>
	                <div class="box span-10">
	                    <h4><?php echo $c->name; ?></h4>
	                    <dl>
		                    <dt class="caps"><?=lang('profile.club.Since')?>: </dt>
				            <dd><?php echo $c->since; ?></dd>
				            <dt class="caps prepend-top"><?=lang('profile.club.Description')?>: </dt>
				            <dd><?php echo nl2br($c->description); ?></dd>
			                <dt class="caps prepend-top"><?=lang('profile.club.Website')?>: </dt>
			                <dd><a href="<?php echo $c->website; ?>" target="_blank"><?php echo $c->website; ?></a></dd>
			                <dt class="caps prepend-top"><?=lang('profile.club.Active')?>: </dt>
			                <dd><?php echo ($c->active)? lang("profile.club.Yes") : lang("profile.club.No"); ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.club.Address')?>: </dt>
		                    <dd><?php echo $c->address_line_1; ?></dd>
		                    <dd><?php echo $c->address_line_2; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.club.Location')?>: </dt>
		                    <dd><?php echo $c->location; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.club.Postcode')?>: </dt>
		                    <dd><?php echo $c->postcode; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.club.Country')?>: </dt>
		                    <dd><?php echo $c->country_code; ?></dd>
	                    </dl>
		            </div>
		            <div class="box span-6 last">
	                    <h4>
	                        <?php if ($isAdmin): ?><?php echo form_checkbox('cid_'.$c->id, 'cid_'.$c->id)?> <?php endif; ?>
	                        <?=lang('profile.club.Membership')?>
	                    </h4>
	                    <dl>
		                    <dt class="caps"><?=lang('profile.club.Joined')?>: </dt>
		                    <dd><?php echo $c->ClubPilotModel[0]->joined; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.club.Member')?>: </dt>
		                    <dd><?php echo $c->ClubPilotModel[0]->member; ?></dd>
                            <?php if ($isAdmin): ?>
                            <dt>&nbsp;</dt>
                            <dd class="">
                                [ <?php echo anchor('profile/club/edit/'.$person->id.'/'.$c->id, lang('profile.club.Edit'))?> 
                                  <?php if ($isOwner) { echo ' | '; echo anchor('profile/club/delete/'.$person->id.'/'.$c->id, lang('profile.club.Delete')); }?> ]
                            </dd>
                            <?php endif; ?>
                        </dl>
		            </div>
		            <?php endforeach; ?>
		            <?php if ($isOwner): ?>
		            <div class="span-16 last form-actions-panel">
		               <?php echo anchor('profile/club/add/'.$person->id, lang('profile.club.Add'))?> | 
		               <?php echo form_submit('action', lang('profile.club.Delete')); ?>
		            </div>
		            <?php endif; ?>
	            <?php endif; ?>
			<?php echo form_close(); ?>
        </div> <!-- end content -->
          <div class="span-6 last" id="sidebar">
            <?php $this->load->view('menu/sidebar', array('person' => $person, 'context' => 'profile/club'))?>
          </div> <!-- end sidebar -->
    </div> <!-- end container -->
</div> <!-- end main -->
<?php $this->load->view('footer/standard');?>
